import React from 'react';
import { withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import reducer, { getList, delCollect, filter } from '../../store/user/collect';
import MyCollection from '../../components/user/MyCollection';
import { injectReducer } from '../../store/reducers';
import store from '../../store/createStore';
const mapStateToProps = state => ({
  list: state.collect.list,
  loading: state.collect.loading,
  deleting: state.collect.deleting
});

const mapDispatchToProps = {
  getList,
  delCollect,
  filter
};

injectReducer(store, { key: 'collect', reducer });
export default withRouter(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(MyCollection)
);
